package com.qf.dao;

import com.qf.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @ClassName UserDao
 * @Description TODO
 * @Author 86181
 * @Date 2022/9/13 14:22
 * @Version 1.0
 **/

@Mapper
public interface UserDao {
    @Select("select * from user")
    List<User> findAllUser();
    //添加
    @Insert("insert into user(nam,sex,pwd,birth) values(#{nam},#{sex},#{pwd},#{birth})")
    int addUser(User user);
    //单查
    @Select("select * from user where id=#{id}")
    User findUserById(int id);
    //修改
    @Update("update user set nam=#{nam},sex=#{sex},pwd=#{pwd},birth=#{birth} where id=#{id} ")
    int updateUser(User user);
    //删除
    @Delete("delete  from user where id=#{id}")
    int deleteUser(int id);
    //登录
    @Select(" select * from user where nam=#{nam}")
    User findByUserName(@Param("nam") String nam);
}
